*Appendix Figure E2, Pre-Treatment ATM Terminal Per Capita Counts and Distance to Currency Chests

clear all
use figure_e6

gen avg = .
gen inter = .

forvalues i = 0(1)40 {
local x = `i' + 1 
sum pred_nfs_atmcount_pc if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("ATMs Per Capita", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("ATM Terminals")
graph save "$results\pre_demon_atm_pc_dist_cc", replace

*Appendix Figure E2, Pre-Treatment POS Terminal Per Capita Counts and Distance to Currency Chests

drop avg inter 

gen avg = .
gen inter = .

forvalues i = 0(1)35 {
local x = `i' + 1 
sum pred_pos_terminalcount_pc if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("POS Terminals Per Capita", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("POS Terminals")
graph save "$results\pre_demon_pos_pc_dist_cc", replace

*Appendix Figure E2, Pre-Treatment Bank Branches Per Capita and Distance to Currency Chests

drop avg inter 

gen avg = .
gen inter = .

forvalues i = 0(1)35 {
local x = `i' + 1 
sum imp_pin_branch_pc if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Bank Branches Per Capita", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Bank Branches")
graph save "$results\pre_demon_branch_pc_dist_cc", replace

*Appendix Figure E2, Pre-Treatment Pincode Population and Distance to Currency Chests

drop avg inter 

gen avg = .
gen inter = .

forvalues i = 0(1)35 {
local x = `i' + 1 
sum imp_pop_pin if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Population (Million)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Population")
graph save "$results\pre_demon_pop_dist_cc", replace

*Appendix Figure E2, Rural Pincode and Distance to Currency Chests

drop avg inter 

gen avg = .
gen inter = .

forvalues i = 0(1)35 {
local x = `i' + 1 
sum pin_rural if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Fraction Rural", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Rural Pincodes")
graph save "$results\pre_demon_ruralpin_dist_cc", replace
 
*Appendix Figure E2, Distance to Urban Centres and Distance to Currency Chests

drop avg inter 

gen avg = .
gen inter = .

forvalues i = 0(1)35 {
local x = `i' + 1 
sum dist_vurban if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Distance (Km)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Distance to Urban Centre")
graph save "$results\pre_demon_distvurb_dist_cc", replace


*Appendix Figure E3, Pre-Treatment Share of ATM Cash Withdrawals and Distance to Currency Chests

drop avg inter 

forvalues i = 0(1)35 {
local x = `i' + 1 
sum pred_sh_nfs_totalamount if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Share", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Share of ATM Withdrawals")
graph save "$results\pre_demon_sh_nfs_amt", replace


*Appendix Figure E3, Pre-Treatment Share of Bank Deposits and Distance to Currency Chests

drop avg inter 

forvalues i = 0(1)35 {
local x = `i' + 1 
sum sh_natl_dep_amt16 if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("Share", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("Share of Deposits")
graph save "$results\pre_demon_sh_dep_amt", replace


*Appendix Figure E3, Pre-Treatment ATM Transaction Counts and Distance to Currency Chests

drop avg inter 


forvalues i = 0(1)35 {
local x = `i' + 1 
sum ln_pred_nfs_transcount if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("ATM Transactions (Log)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("ATM Counts")
graph save "$results\pre_demon_atm_trans_dist_cc", replace

*Appendix Figure E3, Pre-Treatment ATM Cash Withdrawal Volumes and Distance to Currency Chests

drop avg inter 


forvalues i = 0(1)35 {
local x = `i' + 1 
sum ln_pred_nfs_totalamount if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("ATM Volume (Log)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("ATM Volume")
graph save "$results\pre_demon_atm_vol_dist_cc", replace

*Appendix Figure E3, Pre-Treatment POS Transaction Counts and Distance to Currency Chests

drop avg inter 

forvalues i = 0(1)35 {
local x = `i' + 1 
sum ln_pred_pos_transcount if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("POS Transactions (Log)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("POS Counts")
graph save "$results\pre_demon_pos_trans_dist_cc", replace

*Appendix Figure E3, Pre-Treatment POS Transaction Volumes and Distance to Currency Chests

drop avg inter 


forvalues i = 0(1)35 {
local x = `i' + 1 
sum ln_pred_pos_totalamount if dist_cc >= `i' & dist_cc < `x'
replace avg = r(mean) if dist_cc >= `i' & dist_cc < `x'
replace inter = (`i' + `x')/2 if dist_cc >= `i' & dist_cc < `x'
} 

duplicates drop inter, force

scatter avg inter || lfit avg inter, xtitle("Distance (Km)") ytitle("POS Volume (Log)", height(5)) graphregion(color(white)) legend(off)  ylabel(#3) subtitle("POS Volume")
graph save "$results\pre_demon_pos_vol_dist_cc", replace
